package com.hotelManagerSystem.service.impl;

import com.hotelManagerSystem.model.RoomOrder;
import com.hotelManagerSystem.mapper.RoomOrderMapper;
import com.hotelManagerSystem.service.IRoomOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author treasy
 * @since 2021-12-22
 */
@Service
@Primary
public class RoomOrderServiceImpl extends ServiceImpl<RoomOrderMapper, RoomOrder> implements IRoomOrderService {
    @Autowired
    private RoomOrderMapper roomOrderMapper;

    //根据orderState查房间预订信息
    @Override
    public List<RoomOrder> queryInfoByState(Integer orderState) {
        return roomOrderMapper.queryInfoByState(orderState);
    }

    @Override
    public List<RoomOrder> queryInfoByUsername(Integer uid) {
        return roomOrderMapper.queryInfoByUsername(uid);
    }

    @Override
    public List<RoomOrder> queryInfoByUsernameAndState(Integer uid, Integer orderState) {
        return roomOrderMapper.queryInfoByUsernameAndState(uid,orderState);
    }


    /*@Override
    public int updateStateById(int roomOrderId) {
        return roomOrderMapper.updateStateById(roomOrderId);
    }
*/
    @Override
    public List<RoomOrder> queryRoomOrderByOrderNum(String orderNum_s) {
        return roomOrderMapper.queryRoomOrderByOrderNum(orderNum_s);
    }

    @Override
    public int updateStateById(Integer roomId) {
        return roomOrderMapper.updateStateById(roomId);
    }

}
